﻿<Window 
    x:Class="ImageLib.Shell.View.MainWindow_Orig" 
    Title="MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:valc="clr-namespace:ImageLib.Shell.ValueConverter"
    mc:Ignorable="d" 
    Height="400" 
    Width="600" 
    DataContext="{Binding Main, Mode=OneWay, Source={StaticResource Locator}}" 
    SnapsToDevicePixels="True" Initialized="Window_Initialized">
    <Window.Resources>
        <ResourceDictionary>
            <valc:MatchToBoolConverter x:Key="MatchToBool"/>
            <valc:NotBoolConverter x:Key="NotConverter"/>
            <Style TargetType="{x:Type RadioButton}">
            	<Setter Property="VerticalAlignment" Value="Center"/>
            	<Setter Property="Margin" Value="3,0"/>
            </Style>
            <DataTemplate x:Key="BasicImageDataTemplate">
            	<Grid>            		
            		<Button Content="{Binding Item.Name}" Command="{Binding ClickCommand, Mode=OneWay}"/>
            	</Grid>
            </DataTemplate>
        </ResourceDictionary>
    </Window.Resources>
    <Grid Grid.IsSharedSizeScope="True">    	
    	<Border BorderBrush="Black" BorderThickness="1" >
    		<Grid >
    			<Grid.ColumnDefinitions>
    				<ColumnDefinition MinWidth="100" Width="1"/>
    				<ColumnDefinition Width="5"/>
    				<ColumnDefinition/>
    			</Grid.ColumnDefinitions>
    			<Grid>
    				<Grid.RowDefinitions>
    					<RowDefinition Height="Auto" SharedSizeGroup="HeaderRow"/>
    					<RowDefinition/>
    				</Grid.RowDefinitions>
    				<StackPanel>
    					<Button Content="Add Library" HorizontalAlignment="Left" VerticalAlignment="Center" Command="{Binding MainCommand}" CommandParameter="AddLibrary"/>
    				</StackPanel>
    				<Grid Grid.Row="1">
    					<Grid.RowDefinitions>
    						<RowDefinition Height="Auto"/>
    						<RowDefinition/>
    					</Grid.RowDefinitions>
    					<ListBox ItemsSource="{Binding Libraries}" ItemTemplate="{DynamicResource LibraryItemDataTemplate}" >
    						<ListBox.Resources>
    							<DataTemplate x:Key="LibraryItemDataTemplate">
    								<Grid>    									
    									<Button Content="{Binding Item.Name}" Command="{Binding ClickCommand, Mode=OneWay}"/>
    								</Grid>
    							</DataTemplate>
    						</ListBox.Resources>
    					</ListBox>
    					<ListBox ItemsSource="{Binding Folders}" SelectedItem="{Binding CurrentFolder}" Grid.Row="1"/>
    				</Grid>
    			</Grid>
    			<Grid Grid.Column="2">
    				<Grid.RowDefinitions>
    					<RowDefinition Height="Auto" SharedSizeGroup="HeaderRow"/>
    					<RowDefinition/>
    				</Grid.RowDefinitions>
    				<Grid>
    					<Grid.ColumnDefinitions>
    						<ColumnDefinition/>
    						<ColumnDefinition Width="Auto"/>
    					</Grid.ColumnDefinitions>
    					<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="1">
    						<StackPanel Orientation="Horizontal">
    							<RadioButton Content="All" Command="{Binding MainCommand}" CommandParameter="GetCurrentLibraryImages" IsChecked="{Binding ShowAllImages}"/>
    							<RadioButton Content="Folder" Command="{Binding MainCommand}" CommandParameter="GetCurrentFolderImages" IsChecked="{Binding ShowAllImages, Converter={StaticResource NotConverter}}"/>
    						</StackPanel>
    						<Rectangle Fill="Black" Width="1" StrokeThickness="0" Margin="4,2"/>
    						<StackPanel Orientation="Horizontal">
    							<RadioButton Content="Sm Icons" IsChecked="{Binding ImageListType, ConverterParameter=Small Icons, Converter={StaticResource MatchToBool}}" Command="{Binding MainCommand}" CommandParameter="Small Icons"/>
    							<RadioButton Content="L Icons" IsChecked="{Binding ImageListType, ConverterParameter=Large Icons, Converter={StaticResource MatchToBool}}" Command="{Binding MainCommand}" CommandParameter="Large Icons"/>
    							<RadioButton Content="Tiles" IsChecked="{Binding ImageListType, ConverterParameter=Tiles, Converter={StaticResource MatchToBool}}" Command="{Binding MainCommand}" CommandParameter="Tiles"/>
    							<RadioButton Content="Content" IsChecked="{Binding ImageListType, ConverterParameter=Content, Converter={StaticResource MatchToBool}}" Command="{Binding MainCommand}" CommandParameter="Content"/>
    						</StackPanel>
    					</StackPanel>
    					<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
    						<TextBlock HorizontalAlignment="Left" Padding="5,0" Text="Library:" />
    						<TextBlock HorizontalAlignment="Left" Padding="5,0" Text="{Binding CurrentLibraryName}" ToolTip="{Binding CurrentLibraryPath}" />
    					</StackPanel>
    				</Grid>
    				<ListBox Grid.Row="1" ItemsSource="{Binding Images}" ItemTemplate="{DynamicResource BasicImageDataTemplate}"/>
    			</Grid>
    			<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" Margin="-2,0" />
    		</Grid>
        
    	</Border>
        
    </Grid>
</Window>
